package www.xudan.javabasedemo.model.Proxy.DynamicsProxy.vertical;

import java.lang.reflect.Proxy;

/**
 * Created by ${XuDan} on 2020/3/23.
 */
public class Client {
    public static void main(String[] args) {
        //纵向代理调用
        ZuFang zf = new ZuKe(1000);
        VerticalProxy verticalProxy = new VerticalProxy(zf);
        ZuFang o = (ZuFang) Proxy.newProxyInstance(ClassLoader.getSystemClassLoader(),
                zf.getClass().getInterfaces(),
                verticalProxy);
        //代理类调用方法
        o.findfangzi();
        int zufang = o.zufang();
        System.out.println("实际房租是:" + zufang);
        o.hetong();

        ZuFang c=new CompanyZF(10000);

    }
}
